test: add litesvm ts testcases#585
Conversation
dev-jodee
left a comment
There was a problem hiding this comment.
Can you fix the CI gh action failure
Greptile SummaryThis PR moves the native CPI TypeScript test to LiteSVM. The main changes are:
Confidence Score: 4/5The changed test path can report success without running the new LiteSVM cases.
basics/cross-program-invocation/native/tests/test.ts Important Files Changed
Reviews (1): Last reviewed commit: "test: add litesvm ts testcases" | Re-trigger Greptile |
| } from "@solana/web3.js"; | ||
| import * as fs from "node:fs"; | ||
| import * as path from "node:path"; | ||
| import { before, describe, it } from "node:test"; |
There was a problem hiding this comment.
The package script still runs this file through ts-mocha, but these imports register suites with Node's node:test runner instead of Mocha. When pnpm test loads the file, Mocha can see an empty suite and report success without running the CPI transactions.
| import { before, describe, it } from "node:test"; | |
| import { before, describe, it } from "mocha"; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| const res = svm.sendTransaction(tx); | ||
| if (!(res instanceof TransactionMetadata)) { | ||
| throw new Error(`Transaction failed: ${res.meta().toString()}`); |
There was a problem hiding this comment.
If sendTransaction returns its failed-transaction variant, this branch assumes that object has meta() and can throw a TypeError while building the error message. A real program error or funding failure would then lose the LiteSVM failure details and report the wrong exception.
hy @Perelyn-sama raised PR here addressing the closed PR #392
Also I have noticed almost every ts test file for native program in basic are in bankrun.